package com.s3s.ssm.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.s3s.ssm.interfaces.store.IStoreService;
import com.s3s.ssm.service.impl.AbstractModuleServiceImpl;
import com.sunrise.xdoc.entity.store.Store;

@Transactional
@Service("storeServiceImpl")
public class StoreServiceImpl extends AbstractModuleServiceImpl implements IStoreService {

    @Override
    public void init() {
        serviceProvider.register(IStoreService.class, this);
//        try {
//            getCacheDataService().registerCache(CacheId.REF_LIST_MOVE_STORE, this,
//                    this.getClass().getMethod("getMoveStoreOrders"));
//            getCacheDataService().registerCache(CacheId.REF_LIST_STORE, this, this.getClass().getMethod("getStores"));
//            getCacheDataService().registerCache(CacheId.REF_LIST_SHIP_PRICE_TYPE, this,
//                    this.getClass().getMethod("getShipPriceTypes"));
//            getCacheDataService().registerCache(CacheId.REF_LIST_IMPORT_STORE_STATUS, this,
//                    this.getClass().getMethod("getImportStoreStatusList"));
//            getCacheDataService().registerCache(CacheId.REF_LIST_EXPORT_STORE_STATUS, this,
//                    this.getClass().getMethod("getExportStoreStatusList"));
//            getCacheDataService().registerCache(CacheId.REF_LIST_MOVE_STORE_STATUS, this,
//                    this.getClass().getMethod("getMoveStoreStatusList"));
//        } catch (NoSuchMethodException | SecurityException e) {
//            throw new RuntimeException("Cannot register method to cache service!", e);
//        }
    }

    @Override
    public List<Store> getAllStores() {
        return getDaoHelper().getDao(Store.class).findAll();
    }

}
